$(function () {
    let id=localStorage.getItem("messageId");
    findById(id);
})

function findById(id) {
    let data=myAjax("/back/message/messageFindById",{id: id},"get");
    setData(data.messageModel);
}

function setData(data) {
    $("#id").val(data.id);
    $("#name").val(data.name);
    $("#phone").val(data.phone);
    $("#mailbox").val(data.mailbox);
    $("#project").val(data.project);
    $("#message").val(data.message);
    $("#date").val(data.date);
    $("#feedback").val(data.feedback);
}
function messageUpdate() {
    let da={
        id:$.trim($("#id").val()),
        name:$.trim($("#name").val()),
        phone:$.trim($("#phone").val()),
        mailbox:$.trim($("#mailbox").val()),
        project:$.trim($("#project").val()),
        message:$.trim($("#message").val()),
        date:$.trim($("#date").val()),
        feedback:$.trim($("#feedback").val()),

    }
    let data=myAjax("/back/message/messageUpdate",da,"post");
    if (data.count==1){
        alert("反馈成功")
        $('#reght').load('/back/message/messageFindAll.html')//刷新一次页面
    } else {
        alert("反馈失败")
    }
}